﻿#region File and License Information
/*
<File>
	<License>
		Copyright © 2009 - 2017, Daniel Vaughan. All rights reserved.
		This file is part of Calcium (http://calciumsdk.net), 
		which is released under the MIT License.
		See file /Documentation/License.txt for details.
	</License>
	<CreationDate>2009-04-11 19:51:16Z</CreationDate>
</File>
*/
#endregion

using System;
using System.ServiceModel;

using Outcoder.Services.MessageService;

namespace Outcoder.Services
{
	/// <summary>
	/// This service allows feedback to be gathered from a user.
	/// In the implementation this will generally be done using a modal dialog box.
	/// </summary>
	[ServiceContract(Namespace = OrganizationalConstants.ServiceContractNamespace)]
	//[Obsolete("Please use IDialogService")]
	public interface IMessageService
	{
		/// <summary>
		/// Shows a message to a user that must be dismissed before continuing.
		/// </summary>
		/// <param name="message">The message to display.</param>
		/// <param name="caption">The caption to display on the dialog.</param>
		/// <param name="importanceThreshold">The minimum filter level 
		/// that a user must have in order to receive the message.</param>
		[OperationContract(IsOneWay = true, Name = "ShowMessageWithCaption")]
		void ShowMessage(
			string message,
			string caption = null,
			MessageImportance importanceThreshold = MessageImportance.High, 
			string details = null);

		/// <summary>
		/// Shows a warning message to a user that must be dismissed before continuing.
		/// </summary>
		/// <param name="message">The message to display.</param>
		/// <param name="caption">The caption to display on the dialog.</param>
		[OperationContract(IsOneWay = true, Name = "ShowWarningWithCaption")]
		void ShowWarning(string message, string caption = null, string details = null);

		/// <summary>
		/// Shows an error message to a user that must be dismissed before continuing.
		/// </summary>
		/// <param name="message">The message to display.</param>
		/// <param name="caption">The caption to display on the dialog.</param>
		[OperationContract(IsOneWay = true, Name = "ShowErrorWithCaption")]
		void ShowError(string message, string caption = null, string details = null);

		/// <summary>
		/// Asks the user a question where the valid response is either 'yes' or 'no'.
		/// </summary>
		/// <param name="question">The question text.</param>
		/// <param name="caption">The caption to display on the dialog.</param>
		/// <returns><code>true</code> if the user selected 'yes'; 
		/// <code>false</code> otherwise.</returns>
		[OperationContract(Name = "AskYesNoQuestionWithCaption")]
		bool AskYesNoQuestion(string question, string caption = null, string details = null);

		/// <summary>
		/// Asks the user a question where the valid response 
		/// is either 'yes', 'no', or 'cancel.'
		/// </summary>
		/// <param name="question">The question text.</param>
		/// <param name="caption">The caption to display on the dialog.</param>
		/// <returns>The answer from the user. 
		/// <see cref="YesNoCancelQuestionResult"/></returns>
		[OperationContract(Name = "AskYesNoCancelQuestionWithCaption")]
		YesNoCancelQuestionResult AskYesNoCancelQuestion(
			string question, string caption = null, string details = null);

		/// <summary>
		/// Asks the user a question where the valid response 
		/// is either 'ok' or 'cancel.'
		/// </summary>
		/// <param name="question">The question text.</param>
		/// <param name="caption">The caption to display on the dialog.</param>
		/// <returns><code>true</code> if the user selected 'ok'; 
		/// <code>false</code> otherwise.</returns>
		[OperationContract(Name = "AskOkCancelQuestionWithCaption")]
		bool AskOkCancelQuestion(string question, string caption = null, string details = null);

#if SILVERLIGHT || MONODROID || MONOTOUCH
		void AskQuestion<TResponse>(
				IQuestion<TResponse> question,
				Action<QuestionResult<TResponse>> resultHandler) 
					where TResponse : class, IQuestionResult;

	#if WINDOWS_PHONE
		System.Threading.Tasks.Task<QuestionResult<TResponse>> AskQuestionAsync<TResponse>(
			IQuestion<TResponse> question);
	#endif
#else
		[OperationContract(Name = "AskQuestionWithTextResponse")]
		TextResponse AskQuestionWithTextResponse(TextResponseQuestion textResponseQuestion);
#endif
	}
}
